<?php use_helper('Object', 'Validation', 'ObjectAdmin', 'I18N', 'Date') ?>

<?php use_stylesheet('/sf/sf_admin/css/main') ?>

<style type="text/css">
div.visible
{
overflow: visible;
float: none;
position: relative;
}
.style1 {
	font-size: 18px;	
        margin-top: 5px;
}
.style2 {
	font-size: 24px;
	font-weight: bold;
 
}
.style_no_border
  {
      border: 0px; 
     
  }
 
   p.note{text-align:justify;
           line-height:120%;
           font-size: 13px;
           margin-top: 0px;
 
   } 
   p.note1
   { 
      font-style: italic;
      font-size: 13px;
   }
   
   tr.head
   {
      height: 25px;     
      color:green;
      font-size: 25px;
   }
   td.right
     {
         with:80%;
         color:blue;
    }
    table.bg
    { 
        
       height: 60px;
       padding-top: 0px;
       margin-top: -10px;
    }
    p.image
    {
        margin:10px;
    }
    .widther
    {
        width:150px;
    }
    .signature
    {
      
        margin-top:-10px;
        height: 20px;
    }
    .tdsignature
    {
        border-top:  1px solid navy;
    }
    p.under
    {
        margin-top: -15px;
    }
    p.above
    {
         margin-top:0px;
    }
    table
    {
    border-collapse:collapse;
    }
</style>
<?php
mb_internal_encoding('UTF-8');
mb_http_output('UTF-8');
mb_http_input('UTF-8');
mb_language('uni');
mb_regex_encoding('UTF-8');
ob_start('mb_output_handler');
?>
<div class="visible">
<table  class="bg" width="100%">
    <tr>
      <td class="right" width="60%" >
      <span class="style2">PURCHASE ORDER</span><br/>
      <span class="style1">Sunlight  Electrical (Vietnam) Co., Ltd.</span><br />
        20 Doc Lap ave. VSIP 1 Thuan An District, Binh Duong Province,VietNam.<br>
        Phone: (+84-650)3743 505 &nbsp  Fax: (+84-650)3743 508
      </td>
      <td>
          &nbsp;
      </td>
      <td width="30%">
       <p align="center" class="margin-top:10px" >
           <img border="0" src="<?php echo image_path("logo.png"); ?>" width="70%" height="70%">
       </p>
        <span><p align="center">www.sunlightgroup.com</p></span>     
      </td>
    </tr>    
</table>

<br/>
<table width="100%" style="margin-top:0px" >
  <tr class="head">
    <td>P.O NUMBER: <?echo $po->getPono()?></td>
  </tr>
  <tr>
    <td><strong><font size="2">(Vui lòng ghi chú số PO này lên trên tất cả các Hóa đơn được gửi tới công ty SUNLIGHT.
Chúng tôi sẽ không chịu trách nhiệm của việc thanh toán trễ thời hạn nếu trên Hóa đơn không có số PO)<br/>
            To avoid delay in payment, the PO number MUST appear all related correspondence, shipping documents
            (B/L, Packing List and Invoices)</font></strong></td>
  </tr>
  <tr>
    <td><strong><font size="2">Ref: </font> </strong></td>
  </tr>
  <tr>
    <td><strong><font size="2">MR: <? echo $mrno?></font></strong></td>
  </tr>  
  <tr>
    <td><strong><font size="2">To:</font></strong></td>
  </tr>
  <tr>
    <td><strong><font size="2"><?echo $supplier->getName()?></font></strong></td>
  </tr>
  <tr>
    <td><font size="2"><?echo $supplier->getAddress()?></font></td>
  </tr>
  <tr>
    <td><strong><font size="2">Tel: <?echo $supplier->getPhone()?></font></strong></td>
  </tr>
  <tr>
    <td><strong><font size="2">Fax: <?echo $supplier->getFax()?></font></strong></td>
  </tr>
  <tr>
    <td><strong><font size="2">Attn: <?echo $supplier->getContactpersonname()?></font></strong></td>
  </tr>
</table>
<br/>

<table width="100%" border="1" cellpadding="1" cellspacing="0" >
  <tr style="color:#C64934">
    <td><strong><font size="2">PURCHASER</font></strong></td>
    <td><strong><font size="2">P.O. DATE </font> </strong></td>
    <td><strong><font size="2">DELIVERY DATE</font></strong></td>
    <td><strong><font size="2">SHIPPED VIA </font> </strong></td>
    <td><strong><font size="2">PAYMENT TERM </font> </strong></td>
  </tr>
  <tr>
    <td><font size="2"><?echo $CreateName?></font></td>
    <td><font size="2"><?echo $po->getCreatedat('d/m/Y')?></font></td>
    <td><font size="2"><?echo $po->getExparrdate('d/m/Y')?> </font> </td>
    <td><font size="2"><?echo CommonValues::$gPOShip['value'][$po->getShippedvia()]?></font></td>
    <td><font size="2"><?echo $po->getPaymentterm()?></font> </td>
  </tr>
</table>
<br/>
<table width="100%" border="1" cellpadding="1" cellspacing="0" class="under">
  <tr style="color:#C64934">
    <td><strong><font size="2">No</font></strong></td>
    <td><strong><font size="2">DESCRIPTION</font></strong></td>
    <td><strong><font size="2">CODE</font></strong></td>
    <td><strong><font size="2">BRAND</font></strong></td>
    <td><p align="right"><strong><font size="2">QTY</font></strong></td>
    <td><p align="right"><strong><font size="2">UNIT</font></strong></td>
    <td><p align="right"><strong><font size="2">UNIT PRICE </font> </strong></td>
    <td><p align="right"><strong><font size="2">TOTAL<br/>(<?echo $po->getCurrency()?>)</font></strong></td>
  </tr>
<? foreach ($compsList as $key=>$comps){
    $comp = ComponentPeer::retrieveByPK($comps->getComponentId());
?>
  <tr>
    <td><font size="2"><?echo $key+1?></font></td>
    <td><font size="2"><?echo $comp->getDescription()?></font></td>
    <td><font size="2"><?echo $comp->getProductcode()?></font></td>
    <td><font size="2"><?echo $comp->getBrand()?></font></td>
    <td><p align="right"><font size="2"><?echo CommonValues::FormatCurrency($comps->getQty1(), FALSE)?></font></td>
    <td><p align="right"><font size="2"><?echo $comp->getComponentunit()?></font></td>
    <td><p align="right"><font size="2"><?echo CommonValues::FormatCurrency($comps->getQty2())?></font></td>
    <td><p align="right"><font size="2"><?echo CommonValues::FormatCurrency($comps->getQty3())?></font></td>
  </tr>
<?}
?>
  <tr>
    <td colspan="7" class="style_no_border"><p align="right"><strong>
	<font size="2">SUB TOTAL </font> </strong></td>
    <td><p align="right"><font size="2"><?echo CommonValues::FormatCurrency( $po->getSubtotalprice());?></font></td>
  </tr>
  <tr>
    <td colspan="7" class="style_no_border"><p align="right"><font size="2">Value At Tax <?echo $po->getVat() ?>%
	</font> </td>
    <td><p align="right"><font size="2"><?echo $po->getVat()? CommonValues::FormatCurrency( $po->getVat()*$po->getSubtotalprice()/100) : 0?></font></td>
  </tr>
  <tr>
    <td colspan="7" class="style_no_border"><p align="right"><strong>
	<font size="2">TOTAL</font></strong></td>
    <td><p align="right"><font size="2"><? echo CommonValues::FormatCurrency($po->getTotalprice());?></font></td>
  </tr>
</table>

<p class="note">
    <b>
    <font size="1">1. Please send Invoice prior to/on delivery <br>
    2. Enter this order in accordance with prices ,terms<br>
       &nbsp;&nbsp;&nbsp;delivery method , and specifications list above <br>
    3. Please notify us immediately if you are unable to deliver as<br>
    &nbsp;&nbsp;&nbsp;specified . Late delivery penalty will be born by the seller <br>
    4. Supplier will be charge 1% total amount for 1 day late <br>
    5. Seller's acknowledgement of this Order:</font> <br>
    </b>
    <p style="margin-top:-15px;"> <font size="2">(Xác nhận người bán)<br>
    <b> Date </b>(Ngày):</font></p>
   
</p>
<br>
<table style="height:40px" width="100%" >
     <tr>
        <td  width="34%">
		 <hr width="50%" style="margin-left:0px;"/>
           <font size="2">Authorized signature   
       </font>   
       </td>    
       <td  width="33%">
		 <hr width="50%" style="margin-left:0px;"/>
         <font size="2">Authorized by
       </font>
       </td>       
       <td  width="33%">
		  <hr width="50%" style="margin-left:0px;"/>
          <font size="2">Approved by 
       </font> 
       </td>
    </tr>
    <tr style="height:10px;">
        <td width="34%">
          <p class="note1">(Chữ ký có thẩm quyền)</p>
       </td>   
       <!--Authorized by -->
       <td width="33%">           
           <i><?php if ($HasApproved) echo $HOSName; else echo "NOT YET APPROVED"; ?></i><br/>
           <font size="2">Support Head
       </font>
       </td>
       <td width="33%">
           <i><?php if ($HasApproved) echo $GDName; else echo "NOT YET APPROVED"; ?></i><br/>
           <font size="2">General Director</font>
       </td>
    </tr>
     <tr>
        <td width="34%" >
           
       </td>
	   <td width="33%">
            <font size="2">Date : <? echo $HOSSignDate; ?>
       </font>
       </td>
	   <td width="33%">
            <font size="2">Date : <? echo $GDSignDate; ?>
        </font>
        </td>
    </tr>
    <tr>
        <td width="100%" colspan="3" align="center">
           <font size="2">
           <? if ($HasApproved)
           echo "THIS APPROVAL IS EXECUTED BY SUNLIGHT SYSTEM & OFFICIALLY ACCEPTED AS ELECTRONIC SIGNATURE BY BOD"; 
           ?>
			</font>
       </td>    
    </tr>
</table>
</div>